package com.caochenlei.graph;

public class EdgeWeightedGraphTest {
    public static void main(String[] args) {
        EdgeWeightedGraph EWG = new EdgeWeightedGraph(8);
        EWG.addEdge(new Edge(4, 5, 0.35));
        EWG.addEdge(new Edge(4, 7, 0.37));
        EWG.addEdge(new Edge(5, 7, 0.28));
        EWG.addEdge(new Edge(0, 7, 0.16));
        EWG.addEdge(new Edge(1, 5, 0.32));
        EWG.addEdge(new Edge(0, 4, 0.38));
        EWG.addEdge(new Edge(2, 3, 0.17));
        EWG.addEdge(new Edge(1, 7, 0.19));
        EWG.addEdge(new Edge(0, 2, 0.26));
        EWG.addEdge(new Edge(1, 2, 0.36));
        EWG.addEdge(new Edge(1, 3, 0.29));
        EWG.addEdge(new Edge(2, 7, 0.34));
        EWG.addEdge(new Edge(6, 2, 0.40));
        EWG.addEdge(new Edge(3, 6, 0.52));
        EWG.addEdge(new Edge(6, 0, 0.58));
        EWG.addEdge(new Edge(6, 4, 0.93));

        System.out.println("获取EWG的大小：" + EWG.size());
        System.out.println("获取EWG的边数：" + EWG.edge());
        System.out.println("====================");
        for (int v = 0; v < EWG.size(); v++) {
            System.out.println("获取和顶点" + v + "关联的所有边：" + EWG.adj(v));
        }
        System.out.println("====================");
        for (Edge e : EWG.edges()) {
            System.out.println(e);
        }
    }
}
